<!--
 * @Author: zengwj
 * @Date: 2022-06-22 16:58:01
 * @LastEditors: zengwj
 * @LastEditTime: 2022-06-22 17:09:49
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //  实现：object.create 创建一个新对象把现有的对象作为新对象的原型
    //  对象浅拷贝  复杂数据类型指向相同
    var person = {
      name: "Nicholas",
      friends: ["Shelby", "Court", "Van"]
    };
    var anotherPerson = Object.create(person)
    anotherPerson.name = 'gerg'
    anotherPerson.friends.push('rob')

    var anotherPerson2 = Object.create(person)
    anotherPerson2.name = 'zwj'
    anotherPerson2.friends.push('zzz')

    console.log(person)
  </script>
</body>

</html>